#include "ctrlinfo.h"

ctrlInfo::ctrlInfo()
{
    config = CabinetConfig::config();
    comDepotCode = config->getDepartId();
    comDepotName = config->getDepartName();
    cabinetNumber = config->getCabinetId();
}

void ctrlInfo::unicodeTrans()
{
    comDepotName = QString2Unicode(comDepotName);
    userName = QString2Unicode(userName);
    goodsDesc = QString2Unicode(goodsDesc);
    goodsName= QString2Unicode(goodsName);
    productLocation= QString2Unicode(productLocation);
    goodsRegistration = QString2Unicode(goodsRegistration);
}
#include <QDebug>
QString ctrlInfo::QString2Unicode(QString str)
{
    QString strout;

    for (int i=0; i<str.length(); ++i)
    {
        ushort num = str[i].unicode();
        if (num < 255)
        {
            strout.append(QByteArray(1, (char)num));
            continue;
        }
        strout += QString("&#x%1;").arg(QString::number(num, 16));
    }
//    qDebug()<<strout;
    return strout;
}
